'use strict';

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
   const {router, controller} = app;
   /**
    * 玩票的
    */
   router.get('/', controller.home.index);
   router.get('/about', controller.home.about);
   router.get('/contact', controller.home.contact);
   router.get('/blog', controller.home.blog);
   /**
    * 分销首页模拟接口
    */
   // 登陆判断
   router.get('/services/ums/isLogin', controller.userforsales.isLogin);
   // 获取租户
   router.get('/services/userTenant/currentTenant', controller.userforsales.currentTenant);
   // 获取菜单列表
   router.get('/services/menus/mine', controller.userforsales.menus);
   // 支付订单编辑
   router.get('/services/userTenant/boundUI', controller.userforsales.boundUI);
   // 门店信息
   router.get('/services/dashboard/info', controller.userforsales.info);

   /**
    * 用户相关
    */
   router.post('/api/users', controller.user.create);
   router.del('/api/users/:id', controller.user.destroy);
   router.put('/api/users/:id', controller.user.update);
   router.post('/api/users/login', controller.user.login);
   router.get('/api/users/:id', controller.user.find);
   router.get('/api/users/:id/edit', controller.user.find);

   /**
    * 文章相关
    */
   app.post('/api/blog/list', controller.blog.index);
   app.post('/api/blog', controller.blog.create);
   app.get('/api/blog/:id', controller.blog.find);
   app.get('/api/blog/:id/edit', controller.blog.edit);
   app.get('/api/tags', controller.blog.tags);
   app.del('/api/users/:user_id/blog/:id', controller.blog.destroy);
   app.put('/api/users/:user_id/blog/:id', controller.blog.update);
   app.get('/api/archive', controller.blog.archive);

   /**
    * 文章分类
    */
   app.post('/api/catalog', controller.catalog.create);
   app.del('/api/catalog/:id', controller.catalog.destroy);
   app.get('/api/catalog', controller.catalog.list);
   app.get('/api/catalog/:id', controller.catalog.find);
   app.put('/api/catalog/:id', controller.catalog.update);


};
